var t = getApp();

Page({
    data: {
        page: 1
    },
    onLoad: function(t) {
        wx.setNavigationBarTitle({
            title: "直播授权码"
        }), this.getData();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        if (!(this.data.current_page >= this.data.last_page)) {
            var t = this.data.page + 1;
            this.setData({
                page: t
            }), this.getMoreData();
        }
    },
    onShareAppMessage: function() {},
    clickTap: function(a) {
        console.log(a);
        var e = a.currentTarget.dataset.item;
        console.log(e);
        var o = this;
        if (1 == e.type) {
            var n = t.getNetAddresss("plugin.room.frontend.code.activationCode");
            t._getNetWork({
                url: n,
                data: {
                    id: e.id
                },
                success: function(t) {
                    console.log(t), o.getData();
                },
                fail: function(t) {
                    console.log(t);
                }
            });
        }
    },
    getData: function() {
        var a = this, e = t.getNetAddresss("plugin.room.frontend.code.purchasedCode");
        t._getNetWork({
            url: e,
            data: {
                page: a.data.page
            },
            success: function(t) {
                var e = t.data;
                1 == e.result ? (console.log(e), a.setData({
                    info: e.data.data,
                    current_page: e.data.current_page,
                    last_page: e.data.last_page
                })) : wx.showToast({
                    title: e.msg,
                    icon: "none",
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    getMoreData: function() {
        var a = this, e = t.getNetAddresss("plugin.room.frontend.code.purchasedCode");
        t._getNetWork({
            url: e,
            data: {
                page: a.data.page
            },
            success: function(t) {
                var e = t.data;
                1 == e.result ? a.setData({
                    info: a.data.info.concat(e.data.data),
                    current_page: e.data.current_page,
                    last_page: e.data.last_page
                }) : wx.showToast({
                    title: e.msg,
                    icon: "none",
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    }
});